package com.admission.web;

import org.apache.commons.lang.xwork.StringUtils;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;

import com.admission.model.MessageReply;
import com.admission.service.MessageReplyManager;

@Namespace("/base")
@Results({@Result(name = CrudActionSupport.RELOAD, location = "/base/index.action", type = "redirect") })
public class MessageReplyAction extends CrudActionSupport<MessageReply>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private MessageReplyManager messageReplyManager;
	private MessageReply entity;
	private String id;
	
	public MessageReply getModel() {
		return entity;
	}

	@Override
	public String list() throws Exception {
		return RELOAD;
	}
	
	@Override
	public String input() throws Exception {
		return RELOAD;
	}
	
	@Override
	public String save() throws Exception {
		return RELOAD;
	}

	@Override
	public String delete() throws Exception {
		return RELOAD;
	}

	@Override
	protected void prepareModel() throws Exception {
		if (StringUtils.isEmpty(id)) {
			entity = new MessageReply();
		} else {
			entity = messageReplyManager.getById(id);
		}
	}
		
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public MessageReplyManager getMessageReplyManager() {
		return messageReplyManager;
	}
	
	@Autowired
	public void setMessageReplyManager(MessageReplyManager messageReplyManager) {
		this.messageReplyManager = messageReplyManager;
	}

	public MessageReply getEntity() {
		return entity;
	}

	public void setEntity(MessageReply entity) {
		this.entity = entity;
	}


	

	
}
